//
//  FamilyAddressCell.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2020/3/12.
//  Copyright © 2020 tao Tao. All rights reserved.
//

import UIKit

protocol FamilyAddressCellDelegate: NSObjectProtocol {
    func addressViewCell(didClickedEdit cell: FamilyAddressCell)
}

class FamilyAddressCell: UITableViewCell {
    
    weak var delegate: FamilyAddressCellDelegate?

    @IBOutlet private weak var nameLabel: UILabel!
    
    @IBOutlet private weak var statusLabel: UILabel!
    
    @IBOutlet private weak var phoneLabel: UILabel!
    
    @IBOutlet private weak var addressLabel: UILabel!
    
    @IBOutlet private weak var editBtn: UIButton! {
        didSet {
            editBtn.setBackgroundImage(UIImage(color: .white), for: .normal)
            editBtn.setBackgroundImage(UIImage(color: .mainLight), for: .highlighted)
        }
    }
    
    @IBAction private func editBtnClicked(_ sender: UIButton) {
        delegate?.addressViewCell(didClickedEdit: self)
    }
    
    func configure(with vm: FamilyRowViewModel) {
        nameLabel.text = vm.receiveName
        phoneLabel.text = vm.receivePhone
        addressLabel.text = vm.receiveAddress
    }
}
